<!--_meta 作为公共模版分离出去-->
<#include "include/_meta.html">
<!--/meta 作为公共模版分离出去-->

<title>添加管理员 - 管理员管理</title>
<meta name="keywords" content="汽车租赁">
<meta name="description" content="汽车租赁系统">
</head>
<body>
<article class="page-container">
	<form class="form form-horizontal" id="form-admin-add" >
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>账户名称：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="${(account.username)!''}" placeholder="" id="username" name="username">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>账户密码：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="password" class="input-text" autocomplete="off" value="${(account.userpwd)!''}" placeholder="账户密码" id="userpwd" name="userpwd">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>确认密码：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="password" class="input-text" autocomplete="off" value="" placeholder="确认新密码" id="userpwd2" name="userpwd2">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">账户昵称：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" autocomplete="off" value="${(account.nickname)!''}" placeholder="账户昵称" id="nickname" name="nickname">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>真实姓名：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" autocomplete="off" value="${(account.realname)!''}" placeholder="真实姓名" id="realname" name="realname">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机号码：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" autocomplete="off" value="${(account.mobile)!''}" placeholder="手机号码" id="mobile" name="mobile">
		</div>
	</div>
		<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">账户邮箱：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" autocomplete="off" value="${(account.email)!''}" placeholder="账户邮箱" id="email" name="email">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>员工工号：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" autocomplete="off" value="${(account.personid)!''}" placeholder="员工工号" id="personid" name="personid">
		</div>
	</div>	
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">用户状态：</label>
		<div class="formControls col-xs-8 col-sm-9 skin-minimal">
			<div class="radio-box">
				<input name="userstate" type="radio" id="us_1" value="1" checked>
				<label for="sex-1">正常</label>
			</div>
			<div class="radio-box">
				<input type="radio" id="us_0" name="userstate" value="0">
				<label for="sex-2">锁定</label>
			</div>
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">部门编号：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" autocomplete="off" value="${(account.deptcode)!''}" placeholder="部门编号" id="deptcode" name="deptcode">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">角色：</label>
		<div class="formControls col-xs-8 col-sm-9"> <span class="select-box" style="width:150px;">
			<select class="select" id="rolecode" name="rolecode" size="1">
				<option value="0">超级管理员</option>
				<option value="1">区域经理</option>
				<option value="2">点名经理</option>
				<option value="3">员工</option>
			</select>
			</span> </div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">添加人员：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="${(account.adduser)!''}" readonly="true" placeholder="添加人员" name="adduser" id="adduser">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">修改人员：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="" placeholder="修改人员" name="edituser" id="edituser">
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">备注：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<textarea id="remark" name="remark" cols="" rows="" class="textarea"  placeholder="说点什么...100个字符以内" dragonfly="true" onKeyUp="textarealength(this,100)">${(account.remark)!''}</textarea>
			<p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
		</div>
	</div>	
	<div class="row cl">
		<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
			<input class="btn btn-primary radius" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;" onclick="$('#form-admin-add').submit()"/>
		</div>
	</div>
	</form>
</article>

<!--_footer 作为公共模版分离出去--> 
<#include "include/_footer.html">
<!--/_footer /作为公共模版分离出去--> 

<!--请在下方写此页面业务相关的脚本--> 
<script type="text/javascript">
$(function(){

	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form-admin-add").validate({
		rules:{
			username:{
				required:true,
				minlength:4,
				maxlength:16
			},
			userpwd:{
				required:true,
			},
			userpwd2:{
				required:true,
				equalTo: "#userpwd"
			},			
			mobile:{
				required:true,
				isPhone:true,
			},
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			
	   		$.ajax({
	            type: 'put', 
				contentType:"application/json", 
	            url: '/saveEditAccount/${account.uid}', 
	            data:JSON.stringify({
						'username': $("#username").val()+'',
						'userpwd': $("#userpwd").val(),
		                'nickname':$("#nickname").val(),
						'realname':$("#realname").val(),
						'mobile': $("#mobile").val(),
		                'email': $("#email").val(),
		                'personid': $("#personid").val(),
		                'userstate':$("#userstate").val(),
						'deptcode':$("#deptcode").val(),
						'rolecode':$("#rolecode").val(),
						'adduser':$("#adduser").val(),
						'edituser':$("#edituser").val(),						
						'remark':$("#remark").val()
						}),
	            success:function(data){ 
	 				console.log('提交成功！');
	 				var index = parent.layer.getFrameIndex(window.name);
					parent.$("#searchUsers").click();
					parent.layer.close(index);
	            }
	
	        });

			
		}
	});
});
</script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>